<link rel="stylesheet" media="screen" type="text/css" title="fiche_Css" href="_css/fiche2.css" />
<link rel="stylesheet" type="text/css" href="_js/grid/gt_grid.css" />
<link rel="stylesheet" type="text/css" href="_js/grid/skin/vista/skinstyle.css" />
<script type="text/javascript" src="_js/grid/gt_msg_en.js"></script>
<script type="text/javascript" src="_js/grid/gt_grid_all.js"></script>
<script type="text/javascript" src="_js/grid/flashchart/fusioncharts/FusionCharts.js"></script>
<script type="text/javascript" src="_js/grid/calendar/calendar.js"></script>
<script type="text/javascript" src="_js/grid/calendar/calendar-setup.js"></script> 
<script language=javascript>
   function DoDevis(Id, Path)
    {
     var montant = prompt("Veuillez indiquer le montant de la commande :")
	 if (montant != null && montant != '' && montant <= prix)
     {
	  document.forms["Montant"].valeur.value= montant;
	  document.forms["Montant"].action = Path+"&id="+Id;
	  document.forms["Montant"].submit();
     }
    else
     alert("Montant invalide !");
    }
</script>
<script type="text/javascript" >

var grid_demo_id = "myGrid1" ;


var dsOption= {

	fields :[
		{name : 'Numero_ligne'  },
		{name : 'Id_colis'  },
		{name : 'Id_palette'},
		{name : 'Description'  },
		{name : 'Quantite'  },
			],
	recordType : 'array'
}



var colsOption = [
     {id: 'Numero_ligne' , header: "N&#176; ligne" , width :60  },
     {id: 'Id_colis' , header: "Colis" , width :120  },
     {id: 'Id_palette' , header : "palette", width :100 },
	 {id: 'Description' , header: "Description" , width :250  },
	 {id: 'Quantite' , header: "Quantit&eacute;" , width :80  },
];


var gridOption={
	id : grid_demo_id,
	loadURL : "_fct/Usine/ShowComController.php",
	width: 515,//"100%", // 700,
	height: 200,//"100%", // 330,
	container : 'gridbox', 
	replaceContainer : true, 
	encoding : 'UTF-8', // Sigma.$encoding(), 
	dataset : dsOption ,
	columns : colsOption ,
	skin: "vista",
	pageSize:100,
	toolbarContent : 'reload',
	parameters : {'idcom':"<?php echo $_GET['idcom']; ?>"},
};


var mygrid=new Sigma.Grid( gridOption );
Sigma.Util.onLoad(function(){mygrid.render()});

//////////////////////////////////////////////////////////

</script>
 <form method="post" name="Montant">
   <input type="hidden" name="valeur" />
   <input type="hidden" name="entrepot" />
   <input type="hidden" name="cout" />
   </form>
<div id='top'>
			Fiche de la commande N&#176;<?php echo $res_com['Id_Commande']; ?>
		</div>
		<table id="refs">
		<tr>
		<th>Nom du client : </th> <td><?php echo $res_com['Raison_Social']; ?></td>
		<th>GLN_Client : </th> <td><?php echo $res_com['GLN_Client']; ?></td>
		</tr>
		<tr>
		<th>Industriel : </th> <td><?php echo $res_com['us_nom']; ?></td>
		<th>GLN DO : </th> <td><?php echo $res_com['GLN_DO']; ?></td>
		</tr>
		<tr>
		<th>Entrepot : </th> <td><?php echo $res_com['en_nom']; ?></td>
		<th>GLN Entrepot : </th> <td><?php echo $res_com['GLN_Entrepot']; ?></td>
		</tr>
		</table>
<p id="main_title" >Liste des colis relatifs &#224; la commande.</p>
<center>
   <div id="bigbox">
      <div id="gridbox"></div>
    </div>
</center>
<br />
<?php if (isset($offres)) { ?>
<table id="offre" border='1'>
	<caption> Liste des offres transporteurs</caption>
	<tr>
	<th>GLN Transporteur</th><th>Prix Offre</th><th>Etat</th><th>Operations</th>
	</tr>
	<?php foreach ($offres AS $rows) { ?> <tr>
		<td><?php echo $rows['GLN_Transporteur']; ?></td>
		<td><?php echo $rows['Prix_offre']; ?></td>
		<td><?php $etat = do_etat_offre($rows['Etat']); echo $etat; ?></td>
		<td><?php if ($rows['Etat'] == 'P') { ?>
			<a href="<?php echo ABS_PATH.ROOT; ?>?page=Usine/Offre&fct=Usine/Offre&idcom=<?php echo $_GET['idcom']; ?>&glntr=<?php echo $rows['GLN_Transporteur']; ?>&act=accept"><img src='_gfx/icons/accept.png'  alt='404' border='0' title='Accepeter'/></a> <a href="<?php echo ABS_PATH.ROOT; ?>?page=Usine/Offre&fct=Usine/Offre&idcom=<?php echo $_GET['idcom']; ?>&glntr=<?php echo $rows['GLN_Transporteur']; ?>&act=refus"><img src='_gfx/icons/cross.png'  alt='404' border='0' title='Refuser'/></a>
			<?php } else { ?> n/a <?php } ?></td>
		</tr><?php } ?>
</table>
<?php } else { ?> <center> Il n'y a pas d'offres transporteurs disponible a ce jour </center><br/> <?php } ?>
<table id="stats"'>
<tr>
<th>Début de commande : </th><td><?php echo $res_com['Date_Commande']; ?></td>
<th>Livraison commande : </th><td><?php echo $res_com['Date_fin_Liv']; ?></td>
</tr>
<tr>
<th>Etat commande : </th><td><?php echo $etat_val ?> 
<?php if ($res_com['Etat'] == 'e') { ?>
	    <a href="javascript:;" onClick="DoDevis(<?php echo $res_com['Id_Commande']; ?>, '<?php echo ABS_PATH.ROOT.'?page=Usine/FicheCommande&fct=Usine/CommandeAction&action=Devis'; ?>');"><img src="_gfx/icons/accept.png"  alt="404" border="0" title="Accepter"/></a>
	    <a href="<?php echo ROOT; ?>?page=Usine/Commande&fct=Usine/CommandeAction&id=<?php echo $res_com['Id_Commande']; ?>&action=Refuse"><img src="_gfx/icons/delete.png"  alt="404" border="0" title="Annuler"/></a>
	    <?php }
		      else if ($res_com['Etat'] == 'c') {
		?>
	    <a href="javascript:;" onClick="window.open('_tpl/Usine/Entrepot.php?id=<?php echo $res_com['Id_Commande']; ?>', 'popuppage', 'width=350,height=200,top=100,left=100');"><img src="_gfx/icons/send.png"  alt="404" border="0" title="Traiter"/></a>
		<?php } ?></td>
<th>Debut ordre preparation : </th><td><?php echo $res_pre['Date_diffusion_ordre_prepa']; ?></td>
</tr>
<tr>
<th>Fin de prepartion : </th><td><?php echo $res_pre['Date_fin']; ?></td>
<th>Montant : </th><td><?php echo $res_com['Montant']; ?> &#128;</td>
</tr>
<tr>
<th>Couts entrepot : </th><td><?php echo $res_cout['tot_entrepot']; ?></td>
<th>Couts livraison : </th><td><?php echo $res_cout['Couts_livraison']; ?></td>
</tr>
</table>
<div id="chrono">
<?php include_once('_tpl/chrono.php'); ?>
</div>